<template>
  <view class="container">
<!--    <cu-custom
      :bgImage="bgImage"
      bgColor="bgNormal"
      topTitle="我的"
      titleClass="commTitleWhite"
    ></cu-custom> -->
    <view class="content">
      <view class="content_top">
        <image class="" src="@/static/images/my/bg.png"> </image>
        <view class="">{{ userInfo.userName || "" }} </view>
      </view>
      <view class="content_bottom">
        <view
          class="cell_item"
          v-for="(item, index) in list"
          :key="index"
          @click="toPage(item.path)"
        >
          <view class="">
            {{ item.name }}
          </view>
          <image class="" src="@/static/images/icon-right.png"> </image>
        </view>
      </view>
      <view class="login_out" v-if="loginStatus == 1">
        <button @click="loginOut">退出登录</button>
      </view>
    </view>
    <!-- bottom -->
    <view class="company"></view>
  </view>
</template>

<script>
// 单个页面所需接口
export default {
  data() {
    return {
      loginStatus: 0, // 0-未登录  1-已登录
      bgImage: require("@/static/images/my/header.png"),
      list: [
        { name: "在线咨询", path: "/packageC/onlineConsultation/index" },
        // { name: "账号与安全", path: "/packageC/accountAndSecurity/index" },
        { name: "数智", path: "/packageC/ai/index" },
      ],
      userInfo: {},
    };
  },
  methods: {
		initData() {
			console.log('initData====')
			this.userInfo = uni.getStorageSync("userInfo");
			if (this.userInfo) {
			  this.loginStatus = 1;
			} else {
			  this.loginStatus = 0;
			}
		},
    toPage(url) {
			console.log('url', url);
      uni.navigateTo({
        url,
      });
    },
    // 退出登录
    loginOut() {
      uni.clearStorageSync();
      uni.reLaunch({
        url: "/pages/home/login",
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  font-size: 28rpx;
  color: #333333;
  .content {
    padding: 29rpx 27rpx 0;
    .content_top {
      position: relative;
      image {
        width: 100%;
        height: 245rpx;
        background: linear-gradient(180deg, #477afa 0%, #0963eb 100%);
        border-radius: 20rpx;
      }
      view {
        position: absolute;
        top: 50%;
        left: 50%;
        font-size: 45rpx;
        height: 43rpx;
        line-height: 46rpx;
        transform: translate(-50%, -50%);
        color: #fff;
      }
    }
    .content_bottom {
      .cell_item {
        margin-top: 20rpx;
        border-radius: 10rpx;
        background: #fff;
        padding-right: 34rpx;
        padding-left: 42rpx;
        display: flex;
        height: 110rpx;
        justify-content: space-between;
        align-items: center;
        image {
          width: 16rpx;
          height: 26rpx;
        }
      }
    }
    .login_out {
      margin-top: 388rpx;
      button {
        width: 310rpx;
        height: 80rpx;
        line-height: 80rpx;
        background: linear-gradient(90deg, #417ffc, #505eeb);
        box-shadow: 0rpx 6rpx 10rpx 0rpx rgba(22, 121, 253, 0.28);
        border-radius: 40rpx;
        font-size: 32rpx;
        color: #fff;
      }
    }
  }
}
</style>